import i18n from "i18next";
import {
    initReactI18next
} from "react-i18next";
import {
    LANGUAGE
} from 'utils/localStorageConfig';
import en from './en.json'
import zn from './zn.json'
import {
    getSessionItem,
    setSessionItem
} from 'utils/sessionStorage';
let language = '';
if (getSessionItem(LANGUAGE)) {
    language = getSessionItem(LANGUAGE)
} else {
    setSessionItem(LANGUAGE, 'zn')
    language = 'zn'
}
i18n
    .use(initReactI18next)
    .init({
        resources: {
            en: en,
            zn: zn
        },
        lng: language,
        fallbackLng: language,
        keySeparator: false,
        interpolation: {
            escapeValue: false
        }
    });
export default i18n;